var app = getApp()
var QQMapWX = require('../../utils/qqmap-wx-jssdk.js');
Page({
  data: {
    height:0,
  },
  onShareAppMessage: function (res) {
    let member_id = app.globalData.userInfo.member_id
    return {
      title: '成纪先锋微平台',
      path: '/pages/sign-in/sign-in?inviter_id=' + member_id,
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  },
  onLoad: function (options) {
    var that = this;
    console.log(wx.getStorageSync('rd_session'))
    
    wx.getSystemInfo({
      success: function (res) {
        console.log(res);
        that.setData({
           width: res.windowWidth-20,
           height:res.windowHeight })
      }
    })

  },
  onShow: function (e) {
    let that = this
    app.check_logined({
      success: function () {
        
      },
      fail: function () {
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })

  },
  tosignIn(e) {
    let that = this
    app.check_logined({
      success: function () {
        // 只允许从相机扫码
        wx.scanCode({
          onlyFromCamera: true,
          success: (res) => {
            console.log(res)
          }
        })
      },
      fail: function () {
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })
    
  },
});